package aures.ui;

import org.gnome.glade.XML;
import org.gnome.gtk.*;
import org.gnome.glade.*;

import aures.Exceptions.EGuiNotInitialized;

public class AuresWin {
	
	protected XML gladefile;
	protected Window win;
	
	public AuresWin(){

	}
	
	public AuresWin (String src, String root) throws Exception{
		/*
		 * Possible throws:
		 * 		- FileNotFoundException : Glade file not found
		 * 		- EGuiNotInitialized : Gtk library hasn't been initialized yet
		 * */
		if (!AuresGui.Gtk_is_Initialized){
			throw new EGuiNotInitialized("Gtk hasn't been initialized");
		}
		else
		{
			gladefile = Glade.parse(src, root);
			win = (Window)gladefile.getWidget(root);
	    }
		
	}
	
	public Widget getWidget (String wName){
		return (this.gladefile.getWidget(wName));
	}
	
	public void Show(){
		win.showAll();
	}
	
	public void Destroy(){
		this.win.hide();
		this.win = null;
	}

}
